<script src="<?= base_url()?>public/js/jquery.min.js"></script>
<div class="content-wrapper">
    <!-- 内容标题 -->
    <section class="content-header">
      <h1>
        权限管理
      </h1>
      <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i>系统管理</a></li>
        <li><a href="#">权限管理</a></li>
        <li class="active">权限组列表</li>
      </ol>
    </section>

    <div id='content'>
        <section class="content">
            <div class="row">
                <div class="col-xs-12">
                <!-- /.box -->
                    <div class="box">

                        <div class="box-header">
                            <div id='SearchForm'>
                                <div class="row " style="line-height:33px; display: flex;">
                                    <div class="col-xs-3">
                                        <a href="<?= base_url()?>index.php/admin/permis/create" class="btn btn-primary bg-pink btn-big">新建</a>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="box-body">
                            <table class="table table-bordered text-center">
                                <thead><tr>
                                    <th>权限组</th>
                                    <th>描述</th>
                                    <th>是否启用</th>
                                    <th>更新时间</th>
                                    <th>操作</th>
                                </tr></thead>
                                <tbody>
                                    <?php
                                    $idx = 1;
                                    foreach ($permislist as $key=>$permis) {
                                    ?>
                                        <tr style='text-align: left;'>
                                            <td style='padding-left: 4px;'><?= $permis['name']?></td>
                                            <td style='padding-left: 4px;'><?= $permis['description']?></td>
                                            <td style='padding-left: 4px;'>
                                                <?php if(1 == $permis['status']){ ?>
                                                    启用
                                                <?php }else{?>
                                                    禁用
                                                <?php } ?></td>
                                            <td style='padding-left: 4px;'><?= $permis['update_time']?></td>
                                            <td style='padding-left: 4px;'>
                                                <a class="btn btn-default btn-xs btn-flat margin" href='edit/<?= $permis['id']?>' tag='edit_link'>编辑</a>
                                                <a class="btn btn-default btn-xs btn-flat margin" href='enable/<?= $permis['id']?>?status=<?=$permis['status']?>' tag='enable_link'>
                                                    <?php if(1 == $permis['status']){?>
                                                        禁用
                                                    <?php }else{?>
                                                        启用
                                                    <?php }?>
                                                </a>
                                                <a class="btn btn-default btn-xs btn-flat margin" href='setpermis/<?= $permis['id']?>' tag='edit_link'>设置权限</a>
                                            </td>
                                        </tr>

                                    <?php
                                    }
                                    ?>
                            </tbody></table>
                        </div>
                        <!-- /.box-body -->
                    </div>
                </div>
            <!-- /.col -->
            </div>
        <!-- /.row -->
        </section>
    </div>
</div>
<script>
$(function(){
    var is_submit = 1;
    $('a[tag=delete_link]').on('click',function(){
        if(confirm('确定要删除吗？')){
            return true;
        }
        return false;
    });
    $('#createBtn').on('click',function (){
        location.href = '<?=base_url()?>index.php/admin/menu/create';
    });
});
</script>
